//
//  CSBaseViewController.m
//  ChinaShip
//
//  Created by yyk on 2019/1/23.
//  Copyright © 2019年 ChinaShip. All rights reserved.
//

#import "CSBaseViewController.h"

@interface CSBaseViewController ()

@end

@implementation CSBaseViewController

- (void)addBackNavbarItem{
    [self addLeftBackImageButton:[UIImage imageNamed:@"home_back"]];
}

- (void)addLeftBackImageButton:(UIImage *)image{
    UIButton *leftBarButton = [UIButton buttonWithType:UIButtonTypeCustom];
    leftBarButton.frame = CGRectMake(0, 0, 44, 44);
    [leftBarButton setImage:image forState:UIControlStateNormal];
    [leftBarButton addTarget:self action:@selector(popViewController) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftBarButton];
    self.navigationItem.leftBarButtonItem = leftBarButtonItem;
}

- (void)pushVcToOtherVc:(UIViewController *)vc{
     [self.navigationController pushViewController:vc animated:YES];
}

- (void)popViewController{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)showNavBar{
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}

- (void)hiddenNavBar{
    [self.navigationController setNavigationBarHidden:YES animated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
